import { stringify } from 'qs';
import request from '@/utils/request';
import {formDataCode} from '@/utils/utils';

//新增
export async function AddCoupon(params) {
    return request(`/${window.storeId}/Marketing/AddCoupon`, {
      method: 'POST',
      body: {
        ...params
      }
    });
  }

  //获取列表分页
  export async function GetCouponsListWithPage(params) {
    return request(`/${window.storeId}/Marketing/GetCouponsListWithPage?${stringify(params)}`);
}

  //获取Id
  export async function GetCouponById(params) {
    return request(`/${window.storeId}/Marketing/GetCouponById?${stringify(params)}`);
}

// 删除优惠券
export async function DelCoupon(params) {       
    return request(`/${window.storeId}/Marketing/DelCoupon`, {
      method: 'POST',
      headers:{
          'Content-Type':"application/x-www-form-urlencoded",        
      },
      body: formDataCode(params)
    });
}

//编辑
export async function UpdateCoupon(params) {       
    return request(`/${window.storeId}/Marketing/UpdateCoupon`, {
      method: 'POST',
      headers:{
          'Content-Type':"application/x-www-form-urlencoded",        
      },
      body: formDataCode(params)
    });
}

